package com.gonsin.gmessage.example.config;


import com.gonsin.gmessage.logic.mqtt.config.MqttConfig;
import net.bytebuddy.utility.RandomString;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Random;

@Configuration
public class MqttConfiguration {


    /**
     *
     * @return
     */
    @Bean
    public MqttConfig mqttConfig(){
        // 实际业务中，自行从代码里构建 mqttConfig
        MqttConfig config = new MqttConfig();
        config.setPassword("123456");
        config.setUsername("gonsin");
        config.setClientId(RandomString.make(32));
        config.setBroker("tcp://127.0.0.1:1883");
        return config;
    }


}
